<?php

declare(strict_types=1);

namespace App\Request\Amount;

use Hyperf\Validation\Request\FormRequest;

class AmountLogsRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'limit' => 'nullable|numeric|min:1|max:200',
            'account_id' => 'nullable',
            'cate_id' => 'nullable',
            'start_date' => 'nullable|date'
        ];
    }

    public function messages(): array
    {
        return [
            'limit.numeric' => '条目错误',
            'limit.min' => '不能低于最小值',
            'limit.max' => '超出最大条数',
            'start_date.date' => '请选择正确时间',
        ];
    }
}
